<?php


namespace app\common\lib;
use think\Controller;

class Tools extends Controller
{
    public static function get_login_msg($user_id,$status,$msg)
    {
        $_res = trans_ip_add(request()->ip());
        $login_msg = [
            'user_id'       => $user_id,
            'status'        => $status,
            'msg'           => $msg,
            'login_ip'      => request()->ip(),
            'ip_address'       => $_res['ip_address'],
            'point'         => $_res['point'],
            'login_time'    => time()
        ];
        return $login_msg;
    }

    /**
     * isLogin 是否存在session信息
     * @return bool
     */
    public static function isLogin()
    {
        $isLogin = session(config('tools.session')['session_profix'],'',config('tools.session')['session']);
        if (!$isLogin) {
            return false;
        }
        return $isLogin;
    }
}